﻿<%@ Page Title="" Language="C#" MasterPageFile="MasterPage.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        .Left
        {
            border-right: 2px dotted blue;
            width: 30%;
            float: left;
        }
        .Main
        {
            width: 70%;
            clear: both;
        }
        .CmdRow td
        {
            height: 40px;
            border-bottom: 1px solid skyblue;
        }
        .CmdPanel
        {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0px;
            left: 0px;
            visibility: hidden;
            background-color: black;
            opacity: 0.9;
            filter: alpha(opacity=40);
        }
        .CmdPanel table
        {
            width: 100%;
            height: 100%;
        }
        .CmdPanel table .Content
        {
            opacity: 1;
            filter: alpha(opacity=100);
            border: 5px solid orange;
            width: 30%;
            height: 30%;
            background: white;
        }
        .CmdPanel table .Content .Title
        {
            border-bottom: 2px solid orange;
            padding: 5px;
            font-size: 14px;
            font-weight: bold;
            display: block;
            margin-bottom: 10px;
        }
    </style>
    <script type="text/javascript">
        window.onload = function () {
            //alert("1");
        }

        function ShowRenamePanel(type) {
            var typeObj = $("mode");
            switch (type) {
                case 0:
                    var currentName = document.getElementById("<%=TextBoxCurrent.ClientID %>").value;
                    $("<%=TextBoxNewName.ClientID %>").value = currentName;
                    $("type").innerHTML = "修改目录名称";
                    break;
                case 1:
                    $("<%=TextBoxNewName.ClientID %>").value = "";
                    $("type").innerHTML = "新建目录";
                    break;
            }
            typeObj.value = type;
            $("RenamePanel").style.visibility = "visible";
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table width="100%" height="100%" cellpadding="5px" cellspacing="0px">
        <tr class="CmdRow">
            <td colspan="2">
                <asp:TextBox ID="Path" runat="server" Width="487px"></asp:TextBox>
                <asp:Button ID="Go" runat="server" Text="转到" OnClick="Go_Click" />
                <asp:Button ID="Up" runat="server" Text="向上" OnClick="Up_Click" />
                <asp:Button ID="Previous" runat="server" Text="后退" OnClick="Previous_Click" />
                <asp:Button ID="Next" runat="server" Text="前进" OnClick="Next_Click" />&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:FileUpload ID="FileUpload1" runat="server" />
                <asp:Button ID="Upload" runat="server" Text="上传" OnClick="Upload_Click" />
                &nbsp;
                <asp:Button ID="ButtonDelFiles" runat="server" Text="删除选中文件" OnClick="ButtonDelFiles_Click"
                    OnClientClick="return window.confirm('选中的文件都将被删除，确定要删除吗？');" />&nbsp;
            </td>
        </tr>
        <tr>
            <td style="border-right: 1px solid skyblue; width: 200px;" valign="top">
                <div>
                    当前目录：<asp:TextBox ID="TextBoxCurrent" runat="server" Width="113px"></asp:TextBox>
                    <input id="rename" value="改名" onclick="ShowRenamePanel(0);" title="修改当前目录名称" type="button" />
                    <input id="create" value="新建" onclick="ShowRenamePanel(1);" title="新建目录" type="button" />
                    <asp:Button ID="ButtonDelDir" runat="server" Text="删除" OnClick="ButtonDelDir_Click"
                        OnClientClick="return window.confirm('选中目录及其子目录和文件都将被删除，确定要删除选中的目录吗？');" ToolTip="删除选中目录" />
                </div>
                <asp:TreeView ID="TreeView1" runat="server" ImageSet="XPFileExplorer" NodeIndent="15"
                    ShowLines="True" OnSelectedNodeChanged="SelectedNodeChanged" Height="100%" Width="100%">
                    <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
                    <LeafNodeStyle ImageUrl="Images/Folder.png" />
                    <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="2px"
                        NodeSpacing="0px" VerticalPadding="2px" />
                    <ParentNodeStyle Font-Bold="False" ImageUrl="Images/Folder.png" />
                    <RootNodeStyle ImageUrl="Images/folder.png" />
                    <SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
                        VerticalPadding="0px" />
                </asp:TreeView>
            </td>
            <td valign="top">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="100%"
                    BorderWidth="1px" GridLines="Vertical" BackColor="LightGoldenrodYellow" BorderColor="Tan"
                    CellPadding="2" ForeColor="Black" DataKeyNames="FullName" OnRowDeleting="GridView1_RowDeleting">
                    <AlternatingRowStyle BackColor="PaleGoldenrod" />
                    <Columns>
                        <asp:TemplateField HeaderText="选择">
                            <EditItemTemplate>
                                <asp:CheckBox ID="CheckBox1" runat="server" />
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="CheckBox1" runat="server" />
                                <asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("FullName") %>' />
                            </ItemTemplate>
                            <ItemStyle Width="50px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="名称">
                            <ItemTemplate>
                                <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("FullName","Download.aspx?name={0}") %>'
                                    Text='<%# Eval("Name") %>'></asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Extension" HeaderText="类型" />
                        <asp:BoundField DataField="Length" HeaderText="大小" />
                        <asp:BoundField DataField="LastWriteTime" HeaderText="修改日期" />
                        <asp:TemplateField HeaderText="操作" ShowHeader="False">
                            <ItemTemplate>
                                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
                                    OnClientClick="return window.confirm('确定要删除吗？');" Text="删除"></asp:LinkButton>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="Tan" />
                    <HeaderStyle BackColor="Tan" Font-Bold="True" />
                    <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
                    <RowStyle BorderStyle="None" />
                    <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
                    <SortedAscendingCellStyle BackColor="#FAFAE7" />
                    <SortedAscendingHeaderStyle BackColor="#DAC09E" />
                    <SortedDescendingCellStyle BackColor="#E1DB9C" />
                    <SortedDescendingHeaderStyle BackColor="#C2A47B" />
                </asp:GridView>
            </td>
        </tr>
    </table>
    <div id="RenamePanel" class="CmdPanel">
        <table>
            <tr>
                <td align="center">
                    <div class="Content">
                        <div class="Title">
                            <span id="type"></span>
                        </div>
                        新名称：<asp:TextBox ID="TextBoxNewName" runat="server"></asp:TextBox><br />
                        <asp:Button ID="ButtonRename" runat="server" Text="保存" OnClick="ButtonRename_Click" />
                        <input type="hidden" id="mode" name="mode" value="" />
                        <button onclick="$('RenamePanel').style.visibility='hidden'">取消</button>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
